<!--
 * @Description: 登记交底信息
 * @Author: wangwangwang
 * @Date: 2020-08-18 14:50:48
 * @LastEditors: wangwangwang
 * @LastEditTime: 2021-03-29 10:54:13
-->
<template>
  <section>
    <el-dialog v-dialogDrag :visible.sync="visible" width="1120px" :before-close="handleClose" :close-on-click-modal='false'>
      <div slot="title" class="dialog-title" style="font-size:24px;padding-top:20px;text-align:center;">登记交底信息</div>
      <div class="dialoginfo">
        <div class="dialoginfo-title">
          <div :class="type == 0 ? 'active' : 'none'" @click="type = 0">
            <div>销售信息</div>
          </div>
          <div v-if="ButtonList.findIndex(res => (res.buttonValue == 'CWXX')) !== -1" :class="type == 1 ? 'active' : 'none'" @click="type = 1">
            <div>财务信息</div>
          </div>
          <div v-if="ButtonList.findIndex(res => (res.buttonValue == 'SCXX')) !== -1" :class="type == 2 ? 'active' : 'none'" @click="type = 2">
            <div>生产信息</div>
          </div>
        </div>
        <div class="dialoginfo-info">
          <el-form ref="projectForm" :model="projectForm" :disabled="disabled" label-width="120px" label-position="right" hide-required-asterisk>
            <!-- 销售信息 -->
            <div v-show="type === 0">
              <div class="form-title">
                <div>基本工程信息</div>
              </div>
              <el-row>
                <el-col :span="12">
                  <el-form-item>
                    <span slot="label" style="color: #ff0000">交底类型</span>
                    <el-select :key="projectForm.discloseType" v-model="projectForm.discloseType" placeholder="请选择">
                      <el-option label="委托交底" :value="1"></el-option>
                      <el-option label="合同交底" :value="2"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item>
                    <span slot="label" style="color: #ff0000">工程名称</span>
                    <el-input v-model="projectForm.enginnerrName"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item prop="enginnerrNatureId">
                    <span slot="label" style="color: #ff0000">工程性质</span>
                    <el-select ref="enginnerrNature" v-model="projectForm.enginnerrNatureId" placeholder="请选择" @change="$nextTick(()=>{projectForm.enginnerrNature = $refs.enginnerrNature.selectedLabel})">
                      <el-option v-for="(item, index) in enginnerrNatureIdList" :key="index" :label="item.itemName" :value="item.id"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item>
                    <span slot="label" style="color: #ff0000">工程地址</span>
                    <el-input v-model="projectForm.enginnerrAddress"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item>
                    <span slot="label" style="color: #ff0000">行政区</span>
                    <el-cascader v-model="projectForm.administrativeDistrictsId0" style="width:390px;" :options="treeData" filterable @change="administrativeDistrictsIdFun()"></el-cascader>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item>
                    <span slot="label" style="color: #ff0000">联营标识</span>
                    <el-select v-model="projectForm.poolFlag" placeholder="请选择">
                      <el-option label="是" value="1"></el-option>
                      <el-option label="否" value="0"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item>
                    <span slot="label" style="color: #ff0000">内外标识</span>
                    <el-radio-group v-model="projectForm.sidesFlag">
                      <el-radio :label="1">内</el-radio>
                      <el-radio :label="2">外</el-radio>
                    </el-radio-group>
                    <el-select v-if="projectForm.sidesFlag==2" :key="projectForm.sidesFlagType" v-model="projectForm.sidesFlagType" placeholder="请选择" style="width:263px;margin-left:20px;">
                      <el-option label="央企" :value="1"></el-option>
                      <el-option label="地方企业" :value="2"></el-option>
                      <el-option label="其他" :value="3"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item>
                    <span slot="label" style="color: #ff0000">协调主体</span>
                    <el-input v-model="projectForm.coordinateName"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="24">
                  <el-form-item label-width="150px">
                    <span slot="label">工程现场特性描述</span>
                    <el-input v-model="projectForm.enginnerrLiveDescription"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="施工单位">
                    <el-input v-model="projectForm.constructionCompany"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="委托单位">
                    <el-input v-model="projectForm.contractCompany"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="委托期">
                    <el-date-picker v-model="projectForm.entrustBeginTImeEntrustEndTime" style="width:390px;" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" @change="projectForm.entrustBeginTime=projectForm.entrustBeginTImeEntrustEndTime[0]||'',projectForm.entrustEndTime=projectForm.entrustBeginTImeEntrustEndTime[1]||''">
                    </el-date-picker>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="委托量">
                    <el-input v-model="projectForm.entrusNumber" onkeypress='return( /\d|\./.test(String.fromCharCode(event.keyCode)))' @input="projectForm.entrusNumber=$regExp.checkNum(projectForm.entrusNumber)" @blur="projectForm.entrusNumber=$regExp.blurCheckNum(projectForm.entrusNumber)"><template slot="append">方</template></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item>
                    <span slot="label">合同号</span>
                    <el-input v-model="projectForm.contractNo"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="施工工期">
                    <el-date-picker v-model="projectForm.constructionStartDateConstructionEndDate" style="width:390px;" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" @change="projectForm.constructionStartDate=projectForm.constructionStartDateConstructionEndDate[0].slice(0,10)||'',projectForm.constructionEndDate=projectForm.constructionStartDateConstructionEndDate[1].slice(0,10)||''">
                    </el-date-picker>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item>
                    <span slot="label">质监备案号</span>
                    <el-input v-model="projectForm.qiRecord"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item>
                    <span slot="label" style="color: #ff0000">合同单位</span>
                    <el-select ref="businesName" v-model="projectForm.businesNameId" placeholder="请选择" @change="$nextTick(()=>{projectForm.businesName = $refs.businesName.selectedLabel})">
                      <el-option v-for="item in roadWorkList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="合同总量">
                    <el-input v-model="projectForm.contractSumNumber" onkeypress='return( /\d|\./.test(String.fromCharCode(event.keyCode)))' @input="projectForm.contractSumNumber=$regExp.checkNum(projectForm.contractSumNumber)" @blur="projectForm.contractSumNumber=$regExp.blurCheckNum(projectForm.contractSumNumber)"><template slot="append">方</template></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="合同含税总价">
                    <el-input v-model="projectForm.contractPriceOfFax" onkeypress='return( /\d|\./.test(String.fromCharCode(event.keyCode)))' @input="projectForm.contractPriceOfFax=$regExp.checkNum(projectForm.contractPriceOfFax)" @blur="projectForm.contractPriceOfFax=$regExp.blurCheckNum(projectForm.contractPriceOfFax)"><template slot="append">元</template></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item>
                    <span slot="label" style="color: #ff0000">合同生效日期</span>
                    <el-date-picker v-model="projectForm.effectiveDate" type="datetime" value-format="yyyy-MM-dd" placeholder="选择日期时间" style="width:390px;">
                    </el-date-picker>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item>
                    <span slot="label" style="color: #ff0000">合同有效期</span>
                    <el-date-picker v-model="projectForm.firstIndateEndIndate" style="width:390px;" type="daterange" range-separator="至" start-placeholder="开始日期" value-format="yyyy-MM-dd" end-placeholder="结束日期" @change="projectForm.firstIndate=projectForm.firstIndateEndIndate[0]||'',projectForm.endIndate=projectForm.firstIndateEndIndate[1]||''">
                    </el-date-picker>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item>
                    <span slot="label" style="color: #ff0000">合同模式</span>
                    <el-select :key="projectForm.modelOfContract" v-model="projectForm.modelOfContract" placeholder="请选择">
                      <el-option label="包干" :value="1"></el-option>
                      <el-option label="代工" :value="2"></el-option>
                      <el-option label="其他" :value="3"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item>
                    <span slot="label" style="color: #ff0000">预算员</span>
                    <el-select ref="budgetPerson" v-model="projectForm.budgetPersonId" :disabled="handleType==3" placeholder="请选择" @change="$nextTick(()=>{projectForm.budgetPerson = $refs.budgetPerson.selectedLabel})">
                      <el-option v-for="(item,k) in budgetPersonIdList" :key="k" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item>
                    <span slot="label" style="color: #ff0000">销售员</span>
                    <el-select ref="saller" v-model="projectForm.sallerId" :disabled="handleType==3" placeholder="请选择" @change="$nextTick(()=>{projectForm.saller = $refs.saller.selectedLabel})">
                      <el-option v-for="(item,k) in sallerIdList" :key="k" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="处别">
                    <el-select ref="placeType" v-model="projectForm.placeTypeId" placeholder="请选择" @change="$nextTick(()=>{projectForm.placeType = $refs.placeType.selectedLabel})">
                      <el-option v-for="(item, index) in placeTypeList" :key="index" :label="item.itemName" :value="item.id"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label-width="160px">
                    <span slot="label" style="color: #ff0000">甲方项目负责人及权限</span>
                    <el-input v-model="projectForm.firstLeader"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item>
                    <span slot="label" style="color: #ff0000">我司合同签字人</span>
                    <el-select ref="ourCompanyCheckPerson" v-model="projectForm.ourCompanyCheckPersonId" filterable placeholder="请选择" @change="$nextTick(()=>{projectForm.ourCompanyCheckPerson = $refs.ourCompanyCheckPerson.selectedLabel})">
                      <el-option v-for="(item, index) in ourCompanyCheckPersonIdList" :key="index" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="甲方有权对量">
                    <el-input v-model="projectForm.richAmount"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item>
                    <span slot="label" style="color: #ff0000">甲方小票签收人</span>
                    <el-select ref="firstPartySigner" v-model="projectForm.firstPartySignerId" filterable :disabled="handleType==3" placeholder="请选择" @change="$nextTick(()=>{projectForm.firstPartySigner = $refs.firstPartySigner.selectedLabel})">
                      <el-option v-for="(item, index) in firstPartySignerIdList" :key="index" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item prop="firstPartyMailbox" :rules="[{ type: 'email', message: '请输入正确的邮箱地址', trigger:  'change'}]">
                    <span slot="label">甲方指定邮箱</span>
                    <el-input v-model="projectForm.firstPartyMailbox"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item prop="secondPartyMailbox" :rules="[{ type: 'email', message: '请输入正确的邮箱地址', trigger:  'change'}]">
                    <span slot="label">乙方指定邮箱</span>
                    <el-input v-model="projectForm.secondPartyMailbox"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="质量约定">
                    <el-select ref="qualityAgreement" v-model="projectForm.qualityAgreementId" placeholder="请选择" @change="$nextTick(()=>{projectForm.qualityAgreement = $refs.qualityAgreement.selectedLabel})">
                      <el-option v-for="(item, index) in qualityAgreementIdList" :key="index" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="收款方式">
                    <el-select v-model="projectForm.clearingForms" multiple placeholder="请选择" @change="$forceUpdate()">
                      <el-option v-for="item in clearingList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="24">
                  <el-form-item label="发票约定">
                    <el-input v-model="projectForm.ticketAgree" rows='3' type="textarea"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <el-form-item label="串换约定">
                    <el-input v-model="projectForm.circulateAgreed"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <el-form-item label="签证约定">
                    <el-input v-model="projectForm.visaAgreed"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <el-form-item label="交底备注">
                    <el-input v-model="projectForm.disclosureNotes"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>

              <div class="form-title">产品信息</div>
              <el-row>
                <el-col :span="12">
                  <el-form-item>
                    <span slot="label" style="color: #ff0000">强度等级</span>
                    <el-select v-model="projectForm.strengthGradeArr" multiple placeholder="请选择" @change="$forceUpdate()">
                      <el-option v-for="item in strengthGradeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="性能等级">
                    <el-select v-model="projectForm.performanceRateArr" multiple placeholder="请选择" @change="$forceUpdate()">
                      <el-option v-for="item in performanceGradeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="材料要求">
                    <el-select v-model="projectForm.materialRequirementsArr" multiple placeholder="请选择" @change="$forceUpdate()">
                      <el-option v-for="item in meterialRequirementsList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="特殊要求">
                    <el-select v-model="projectForm.specialRequirementsArr" multiple placeholder="请选择" @change="$forceUpdate()">
                      <el-option v-for="item in specialRequirementsList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="其他要求">
                    <el-select v-model="projectForm.otherRequirementsArr" multiple placeholder="请选择" @change="$forceUpdate()">
                      <el-option v-for="item in otherRequirementsList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="外加剂要求">
                    <el-select v-model="projectForm.admixtureRequirementsArr" multiple placeholder="请选择" @change="$forceUpdate()">
                      <el-option v-for="item in admixtureRequirementsList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item>
                    <span slot="label" style="color: #ff0000">浇筑方式</span>
                    <el-select v-model="projectForm.pumpTypeArr" multiple placeholder="请选择" @change="$forceUpdate()">
                      <el-option v-for="item in pumpTypeList" :key="item.id" :label="item.itemName" :value="item.id"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item>
                    <span slot="label" style="color: #ff0000">小方量约定</span>
                    <el-input v-model="projectForm.smallVolume" onblur="if(value > 50 ){ value = 50}else if(value <1){value = 1}" onkeypress='return( /\d|\./.test(String.fromCharCode(event.keyCode)))' @input="projectForm.smallVolume=$regExp.checkNum(projectForm.smallVolume)" @blur="projectForm.smallVolume=$regExp.blurCheckNum(projectForm.smallVolume)">
                      <template slot="append">方/车</template>
                    </el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item>
                    <span slot="label" style="color: #ff0000">约定容重</span>
                    <el-input v-model="projectForm.unitWeight" onblur="if(value > 20000 ){ value = 20000}else if(value <1){value = 1}" onkeypress='return( /\d|\./.test(String.fromCharCode(event.keyCode)))' @input="projectForm.unitWeight=$regExp.checkNum(projectForm.unitWeight)" @blur="projectForm.unitWeight=$regExp.blurCheckNum(projectForm.unitWeight)"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="甲供材料">
                    <el-radio-group v-model="projectForm.armorForMaterials">
                      <el-radio :label="0">无</el-radio>
                      <el-radio :label="1">有</el-radio>
                    </el-radio-group>
                  </el-form-item>
                </el-col>
              </el-row>
              <div v-if="projectForm.armorForMaterials==1">
                <div style="padding-bottom: 10px;">
                  <el-button size="mini" class="bottom_all" style="margin-left: 0;" @click="addItem()">
                    <i class="icon iconfont iconicon_button_add" style="font-size: 12px;"></i>
                    添加
                  </el-button>
                </div>
                <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width:100%" :data="projectForm.list" tooltip-effect="dark">
                  <el-table-column label="甲供材料名称" align="center" width="150">
                    <template slot-scope="scope">
                      <span v-if="scope.row.materials" class="table_link" style="cursor:pointer;" @click="ListChoiceTypeFun(scope.$index,scope.row.materialsId)">{{scope.row.materials}}</span>
                      <span v-else class="table_link" style="cursor:pointer;" @click="ListChoiceTypeFun(scope.$index)">选择</span>
                    </template>
                  </el-table-column>
                  <el-table-column label="型号" align="center" prop="specification" width="auto"></el-table-column>
                  <el-table-column label="单方掺量" align="center">
                    <template slot-scope="scope">
                      <el-input-number v-model="scope.row.mixingAmount" :precision="0" style="width: 100%;" :controls="false"></el-input-number>
                    </template>
                  </el-table-column>
                  <el-table-column label="操作" align="left" prop="specification" width="100">
                    <template slot-scope="scope">
                      <el-button size="mini" class="bottom_two" @click="deleteItem(scope.$index)">
                        <i class="icon iconfont iconicon_button_delete" style="font-size: 12px;"></i>
                        删除
                      </el-button>
                    </template>
                  </el-table-column>
                </el-table>
              </div>
              <div class="form-title">交底附件</div>
              <div style="padding-left:50px;">
                <div class="form-title">合同相关文件</div>
                <FileComponent fileCode="contractFile2" :disabled="disabled" :files="listFilesa1" @deleteFile="deleteFile1" @uplodeSuccess="uplodeSuccess1" />
              </div>
            </div>
            <!-- 财务信息 -->
            <div v-show="type === 1" style="padding:0px 130px;">
              <div class="form-title">
                <div>财务信息</div>
              </div>
              <div>
                <el-form-item label="建委合同号" label-width="120px">
                  <span slot="label" style="color: #ff0000">财务编码</span>
                  <el-input v-model="projectForm.financialCode" style="width: 250px;"></el-input>
                </el-form-item>
              </div>
            </div>
            <!-- 生产信息 -->
            <div v-show="type === 2" style="padding:0px 130px;">
              <div class="form-title">
                <div>生产信息</div>
              </div>
              <el-row>
                <el-form-item label="建委合同号">
                  <span slot="label" style="color: #ff0000">建委合同号</span>
                  <el-input v-model="projectForm.ccContractNo" style="width: 250px;"></el-input>
                </el-form-item>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item>
                    <span slot="label" style="color: #ff0000">主供应站点</span>
                    <el-select ref="selection1" v-model="projectForm.mainSupplySiteId" style="width: 250px;" placeholder="请选择" @change="choiseBussinessPoint(type),$nextTick(()=>{projectForm.mainSupplySite = $refs.selection1.selectedLabel})">
                      <el-option v-for="item in pointIdList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item>
                    <span slot="label" style="color: #ff0000">主供应站点距离</span>
                    <el-input v-model="projectForm.mainSupplySiteDistence" style="width: 250px;" onkeypress='return( /\d|\./.test(String.fromCharCode(event.keyCode)))' @input="projectForm.mainSupplySiteDistence=$regExp.checkNum(projectForm.mainSupplySiteDistence)" @blur="projectForm.mainSupplySiteDistence=$regExp.blurCheckNum(projectForm.mainSupplySiteDistence)"><template slot="append">千米</template></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="20">
                  <el-form-item>
                    <span slot="label">增值服务项</span>
                    <span>{{servicePoint}}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-button class="bottom_two" style="margin-left:25px;" @click="choiseBussinessPoint()">更改</el-button>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="辅供应站点">
                    <el-select ref="secondSupplySite" v-model="projectForm.secondSupplySiteId" style="width: 250px;" placeholder="请选择" @change="$nextTick(()=>{projectForm.secondSupplySite = $refs.secondSupplySite.selectedLabel})">
                      <el-option v-for="item in pointIdList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="辅供应站点距离">
                    <el-input v-model="projectForm.secondSupplySiteDistence" style="width: 250px;" onkeypress='return( /\d|\./.test(String.fromCharCode(event.keyCode)))' @input="projectForm.secondSupplySiteDistence=$regExp.checkNum(projectForm.secondSupplySiteDistence)" @blur="projectForm.secondSupplySiteDistence=$regExp.blurCheckNum(projectForm.secondSupplySiteDistence)"><template slot="append">千米</template></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
            </div>
          </el-form>
        </div>
        <div v-if="!disabled" style="color: #ff0000; font-size: 12px; padding-top: 9px">
          提交审核前，请确认以上交底信息填写完整！
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all" style="position: absolute;left:0px;" @click="discloseQueryPageFun(data.id)">修改记录</el-button>
        <el-button class="bottom_all_two" @click="handleClose">取 消</el-button>
        <el-button v-if="!disabled&&handleType==1" class="bottom_all" type="primary" @click="handleSave">保存</el-button>
        <el-button v-if="!disabled&&handleType!=3" class="bottom_all" type="primary" @click="handleSure">提交审核</el-button>
      </span>
    </el-dialog>
    <!-- 管控业务点 -->
    <el-dialog v-dialogDrag :visible.sync="bussinessVisible" width="60%">
      <span slot="title" class="dialog-title">管控业务点</span>
      <el-checkbox-group v-model="buspointids">
        <template v-for="(item,index) in buspointArr">
          <div :key="index" class="checkbox-bg">
            <el-checkbox :label="item.id">{{item.itemName}}</el-checkbox>
          </div>
        </template>
      </el-checkbox-group>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="bussinessVisible = false">关 闭</el-button>
        <el-button class="bottom_all" @click="handlePoint">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 列表单选 -->
    <el-dialog v-dialogDrag :visible.sync="ListChoiceType" width="980px" :close-on-click-modal="false">
      <span slot="title" class="dialog-title">选择</span>
      <div class="dialogOtherinfo">
        <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width:100%" :data="ListChoiceData" tooltip-effect="dark" highlight-current-row @row-click="ListChoiceFun">
          <el-table-column width="55">
            <template slot-scope="scope">
              <el-radio v-model="ListChoiceRadio" :label="scope.row.id">{{""}}</el-radio>
            </template>
          </el-table-column>
          <el-table-column prop="id" label="原物料ID" width="auto" align="center"></el-table-column>
          <el-table-column prop="name" label="原物料名称" width="auto" align="center"></el-table-column>
          <el-table-column prop="brand" label="品牌" width="auto" align="center"></el-table-column>
          <el-table-column prop="specification" label="规格" width="auto" align="center"></el-table-column>
          <el-table-column prop="typeName" label="类型" width="auto" align="center"></el-table-column>
          <el-table-column prop="enable" label="状态" width="auto" align="center">
            <template slot-scope="scope">
              <span v-if="scope.row.enable == 0" style="color:#969799;">禁用</span>
              <span v-if="scope.row.enable == 1" style="color:#00A754;">启用</span>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination :current-page.sync="ListChoicePaging.page" :page-size="ListChoicePaging.pageSize" layout="total, prev, pager, next, jumper" :total="ListChoicePaging.total" @current-change="ListChoicePagingFun(true)"></el-pagination>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="ListChoiceType = false">取 消</el-button>
        <el-button class="bottom_all" style="margin-left: 24px;" @click="ListChoiceAddFun()">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 更改记录列表 -->
    <el-dialog v-dialogDrag :visible.sync="lookType" width="600px" :close-on-click-modal="false">
      <span slot="title" class="dialog-title">更改记录列表</span>
      <div class="dialogOtherinfo">
        <el-table ref="table11Refs" height="400" :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width:100%" :data="listArr" tooltip-effect="dark" highlight-current-row>
          <el-table-column prop="createUserName" label="更改人" width="auto" align="center"></el-table-column>
          <el-table-column prop="createTime" label="更新时间" width="auto" align="center"></el-table-column>
        </el-table>
        <div class="card_bottom">
          <div class="card_bottom_left">
            <div class="top_page_totle">总共{{ modifyPage.total }}条</div>
            <el-pagination :current-page.sync="modifyPage.page" :page-size="modifyPage.pageSize" layout="prev, pager, next, jumper" :total="modifyPage.total" @current-change="discloseQueryPageFun()"></el-pagination>
          </div>
          <div>
            <el-button size="mini" icon="el-icon-refresh-right" class="bottom_all_two" @click="contractQueryPageContractLogFun()">刷新</el-button>
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="lookType = false">取 消</el-button>
        <el-button class="bottom_all" style="margin-left: 24px;" @click="handOverPlansaveClientOrderFun()">确 定</el-button>
      </span>
    </el-dialog>
  </section>
</template>
<script>
import mixin from "@/mixins/ICPSmixin.js";
import treeData from '@/views/platform/ICPS/basicConfig/address.js';
import FileComponent from './fileComponent';
import {
  saveOrUpdateDisclose,
  getDisClostDetail,
  getManagement,
  rawMaterialsQueryPage,
  discloseQueryPage
} from "@/api/internetSales/projectClarifi.js";
import { queryProcesses } from "@/api/basicConfig/proflow.js";
import { getDicType, getListByTypeId, getDicsType, getStationByCompanyId } from "@/api/common.js";
import { queryAllByCompanyId } from '@/api/internetSales/chanceManagement'
import { getLists } from "@/api/smart/schedul/c.js";
import { queryPage as getUserData } from '@/api/basedata/user';
import { setTimeout } from 'timers';
import { get_simple_user_listBycompanyId } from '@/api/GHnumber/contract'
import { getUserInfo } from "@/utils/auth.js";
export default {
  components: { FileComponent },
  props: ["visible", "data", "disabled", 'handleType'],
  mixins: [mixin],
  data() {
    return {
      treeData,
      UserInfo: '',
      administrativeDistrictsPlaceholder: [],
      companylist: [],
      type: 0,
      clearingList: [{
        name: '银行现金转账',
        id: '1',
      }, {
        name: '银行转账汇票',
        id: '2',
      }, {
        name: '商业转账汇票',
        id: '3',
      }, {
        name: '供应链金融产品',
        id: '4',
      }, {
        name: '其他',
        id: '5',
      }],
      projectForm: {
        // 基础信息
        engineeringId: '',
        discloseType: '',
        enginnerrName: '',
        enginnerrNature: '',
        enginnerrNatureId: '',
        enginnerrAddress: '',
        administrativeDistrictsId: '',
        administrativeDistrictsId0: '',
        administrativeDistrictsName: '',
        poolFlag: '',
        sidesFlagType: '',
        sidesFlag: 1,
        coordinateName: '',
        enginnerrLiveDescription: '',
        constructionCompany: '',
        contractCompanyId: '',
        contractCompany: '',
        entrustBeginTImeEntrustEndTime: [],
        entrustBeginTime: '',
        entrustEndTime: '',
        entrusNumber: '',
        contractNo: '',
        constructionStartDateConstructionEndDate: [],
        constructionStartDate: '',
        constructionEndDate: '',
        qiRecord: '',
        firstIndateEndIndate: [],
        firstIndate: '',
        endIndate: '',
        modelOfContract: '',
        budgetPersonId: '',
        budgetPerson: '',
        budgetPersonDepartmentId: '',
        saller: '',
        sallerId: '',
        placeType: '',
        placeTypeId: '',
        firstLeader: '',
        ourCompanyCheckPerson: '',
        ourCompanyCheckPersonId: '',
        richAmount: '',
        firstPartySigner: '',
        firstPartySignerId: '',
        firstPartyMailbox: '',
        secondPartyMailbox: '',
        qualityAgreement: '',
        qualityAgreementId: '',
        clearingForm: [],
        clearingForms: [],
        ticketAgree: '',
        circulateAgreed: '',
        visaAgreed: '',
        disclosureNotes: '',
        strengthGrade: '',//强度等级
        strengthGradeArr: [],//强度等级
        performanceRate: '',//性能等级
        performanceRateArr: [],//性能等级
        materialRequirements: '',//材料要求
        materialRequirementsArr: [],//材料要求
        specialRequirements: '',//特殊要求
        specialRequirementsArr: [],//特殊要求
        otherRequirements: '',//其他要求
        otherRequirementsArr: [],//其他要求
        admixtureRequirements: '',//外加剂要求
        admixtureRequirementsArr: [],//外加剂要求
        pumpType: '',//泵送方式
        pumpTypeArr: [],//泵送方式
        smallVolume: '',
        unitWeight: '',
        armorForMaterials: 0,
        financialCode: '',
        ccContractNo: '',
        mainSupplySiteId: '',
        mainSupplySite: '',
        mainSupplySiteDistence: '',
        secondSupplySite: '',
        secondSupplySiteId: '',
        secondSupplySiteDistence: '',
        list: [],//甲供材料列表
        fileFist: [],//附件
      },
      ListChoiceType: false,
      ListChoiceData: [],
      ListChoiceDataIndex: '',//当前是从第几条数据打开的
      ListChoiceRadio: '',//单选表格选中项
      ListChoiceRadioCopy: '',//当前打开的单选表格选中项
      ListChoiceRadioRow: '',//单选最终选中值
      ListChoicePaging: {//单选表格分页
        pageSize: 5,
        page: 1,
        total: 0
      },
      ourCompanyCheckPersonIdList: [],//公司人员
      budgetPersonIdList: [],//预算员
      sallerIdList: [],//销售员
      firstPartySignerIdList: [],//用料签收员
      qualityAgreementIdList: [],//质量约定
      listFilesa1: [],
      disAddCosts: [],
      strengthGradeList: [], //强度list
      performanceGradeList: [], //性能等级list
      meterialRequirementsList: [], //材料要求list
      specialRequirementsList: [], //特殊要求list
      otherRequirementsList: [], // 其他要求list
      admixtureRequirementsList: [], //外加剂要求list
      pumpTypeList: [],//浇筑方式泵机类型
      enginnerrNatureIdList: [],//工程性质
      placeTypeList: [],//处别
      contractTypeIdList: [],//合同类型
      pointIdList: [],//主供应站点
      roadWorkList: [],//合同单位
      positionList: [], // 岗位列表
      shutdownLogoList: [],
      successCnt: 0,
      fixPosition: [],
      bussinessVisible: false,
      buspointArr: [],
      servicePoint: '',
      buspointids: [],
      lookType: false,
      listArr: [],
      modifyPage: {
        page: 1,
        pageSize: 10,
        total: 0,
        engineeringId: '',
      },
      TreeSelectStypeNumber: 0,
    };
  },
  watch: {
    visible: {
      handler(newData) {
        /*根据公司获取站点*/
        getStationByCompanyId({ id: this.data.companyId }).then((res) => {
          this.pointIdList = res.data.map((v) => {
            return {
              id: v.stationId,
              name: v.stationName
            }
          })
        });
        /*我司合同签字人*/
        get_simple_user_listBycompanyId({
          roleId: '7605679267385344',
          orgznizationId: this.data.companyId
        }).then((res) => {
          this.ourCompanyCheckPersonIdList = res.data;
        });
        /*获取预算员*/
        get_simple_user_listBycompanyId({
          roleId: '48d84b503be7484ca1b5c2eade1ff004',
          orgznizationId: this.data.companyId
        }).then((res) => {
          this.budgetPersonIdList = res.data;
          console.log(JSON.parse(JSON.stringify(this.budgetPersonIdList)))
        });
        /*获取销售员*/
        get_simple_user_listBycompanyId({
          roleId: '12b2f6ff304148fd89141e9faa9afb96',
          orgznizationId: this.data.companyId
        }).then((res) => {
          this.sallerIdList = res.data;
        });
        /*获取用料签收员*/
        get_simple_user_listBycompanyId({
          roleId: '3e32ac0a1e95449d91d80bd97bd30ec7',
          // orgznizationId: this.data.companyId
        }).then((res) => {
          this.firstPartySignerIdList = res.data;
        });
        if (newData) {
          if (this.handleType === 2 || this.handleType === 3) { // 编辑或查看
            this.$nextTick(() => {
              this.$refs.projectForm.resetFields();
              this.getDetail();
            })
          } else {
            this.$nextTick(() => {
              this.$refs.projectForm.resetFields();
              this.$data.projectForm = this.$options.data().projectForm
              this.projectForm.discloseType = this.data.executePhase == 4 ? 2 : this.data.executePhase
              this.projectForm.engineeringId = this.data.id
              this.projectForm.enginnerrName = this.data.name
              this.projectForm.enginnerrAddress = this.data.place
              this.projectForm.enginnerrLiveDescription = this.data.remark
              this.projectForm.enginnerrNatureId = this.data.typeId;
              this.projectForm.businesNameId = this.data.roadworkId;
              this.projectForm.businesName = this.data.roadwork;
              this.projectForm.list = this.data.list || [];
              if (this.data.administrativeDistricts) {
                this.projectForm.administrativeDistrictsId0 = JSON.parse(this.data.administrativeDistricts)
                this.projectForm.administrativeDistrictsId = this.data.administrativeDistricts
                this.$forceUpdate()
              }
              if (this.data.beginTime) {
                this.projectForm.constructionStartDateConstructionEndDate = [this.data.beginTime, this.data.finishTime]
                this.projectForm.constructionStartDate = this.data.beginTime.slice(0, 10)
                console.log(this.projectForm.constructionStartDate);
                this.projectForm.constructionEndDate = this.data.finishTime.slice(0, 10)
                console.log(this.projectForm.constructionEndDate);
              }
            })
          }
        }
      },
    },
  },
  async created() {
    this.UserInfo = getUserInfo();
    this.treeData.forEach((v) => {
      v.children.forEach((res) => {
        res.children.forEach((res2) => {
          delete res2.children
        })
      })
    })
    /**质量约定list */
    getDicType({ code: "TheQualityAgreement" }).then((res) => {
      if (res.data) {
        this.qualityAgreementIdList = res.data.items; //
        this.qualityAgreementIdList.map((res) => res.name = res.itemName)
      }
    });
    /**浇筑方式泵机类型 */
    getDicType({
      code: "castingType",
    }).then((res) => {
      res.data.items.map((v1) => v1.type = 1);
      this.pumpTypeList = res.data.items
      getDicType({
        code: "pouringMethod",
      }).then((res) => {
        res.data.items.map((v2) => v2.type = 2)
        this.pumpTypeList = [...this.pumpTypeList, ...res.data.items];
      });
    });
    /**
     * @Description: 获取5大参数
     * @Param: 
     * @Author: wangwangwang
     */
    getLists().then((res) => {
      res.data.forEach((item) => {
        if (!item) return
        if (item.typeName == "强度等级") {
          this.strengthGradeList = item.list;
        } else if (item.typeName == "规范性能等级") {
          this.performanceGradeList = item.list;
        } else if (item.typeName == "材料要求") {
          this.meterialRequirementsList = item.list;
        } else if (item.typeName == "特殊要求") {
          this.specialRequirementsList = item.list;
        } else if (item.typeName == "外加剂要求") {
          this.admixtureRequirementsList = item.list;
        } else if (item.typeName == "其他要求") {
          this.otherRequirementsList = item.list;
        }
      });
    });
    /**
     * @Description: 获取强度等级
     * @Param: 
     * @Author: wangwangwang
     */
    getListByTypeId({
      typeId: 1,
    }).then((res) => {
      this.arr1 = res.data;
    });
    /**
     * @Description: 获取数据字典
     * @Param: 
     * @Author: wangwangwang
     */
    getDicsType({ codes: "EngineeringNature,contractType,MATname,castingType,shutdownLogo, placeDon, recordFixedPostition, market" }).then((res) => {
      if (res.code === 1001) {
        this.enginnerrNatureIdList = res.data.EngineeringNature.items;
        this.contractTypeIdList = res.data.contractType.items;
        this.arr2 = res.data.MATname.items;
        this.shutdownLogoList = res.data.shutdownLogo.items;
        this.placeTypeList = res.data.placeDon.items;
        this.fixPosition = res.data.recordFixedPostition.items;
        this.buspointArr = res.data.market.items;
      }
    });
    /**
     * @Description: 获取施工单位
     * @Param: 
     * @Author: wangwangwang
     */
    queryAllByCompanyId().then(res => {
      if (res.code === 1001) {
        this.roadWorkList = res.data;
      }
    })
  },
  methods: {
    /**修改记录 */
    discloseQueryPageFun(val) {
      if (val) {
        this.modifyPage.engineeringId = val
      }
      this.lookType = true
      discloseQueryPage(this.modifyPage).then((res) => {
        this.listArr = res.data.data
        this.modifyPage.total = res.data.totalRows
      })
    },
    administrativeDistrictsIdFun() {
      this.projectForm.administrativeDistrictsId = JSON.stringify(this.projectForm.administrativeDistrictsId0)
      this.$forceUpdate()
    },
    /**
     * @Description: 选择管控业务点
     * @Param: 通过选中的站点获取默认选中数据
     * @Author: wangwangwang
     */
    choiseBussinessPoint(type) {
      if (!this.projectForm.mainSupplySiteId) {
        this.$message.warning('请选择主供应站点后再进行操作')
        return
      }
      if (!type) {
        this.bussinessVisible = true;
      }
      if (this.projectForm.servicePoint) {
        const newData = this.projectForm.servicePoint ? JSON.parse(this.projectForm.servicePoint) : [];
        const copyData = newData.filter(item => item.type * 1 === 1);
        this.buspointids = copyData.map(item => item.id);
      } else {
        queryProcesses({ stationId: this.projectForm.mainSupplySiteId }).then(res => {
          if (res.code === 1001) {
            const newData = res.data.servicePoint ? JSON.parse(res.data.servicePoint) : [];
            const copyData = newData.filter(item => item.type * 1 === 1);
            this.buspointids = copyData.map(item => item.id);
            this.servicePoint = copyData.map(item => item.name).join('、');
          }
        })
      }
    },
    handlePoint() {
      const newData = this.buspointArr.filter(item => this.buspointids.some(items => item.id === items));
      this.servicePoint = newData.map(item => item.itemName).join(',');
      this.projectForm.servicePoint = JSON.stringify(newData.map(item => ({ id: item.id, name: item.itemName, type: 1 })));
      this.bussinessVisible = false;
    },
    tableRowClassName({ row }) {
      if (row.dataType == 0) {
        return 'display-row-Fzy';
      }
      return '';
    },
    /**
     * @Description:  通过岗位查找人员
     * @Param: 
     * @Author: wangwangwang
     */
    choisePerson(data) {
      if (!data.postId) {
        this.$message.warning('请先选择角色')
        return
      }
      const params = {
        roleId: data.postId,
        page: 1,
        pageSize: 100,
      }
      getUserData(params).then(res => {
        if (res.code === 1001) {
          data.list = res.data.data;
          console.log(data.list);
          this.$forceUpdate()
        }
      })
    },
    /**
     * @Description: 设置电话号码
     * @Param: 
     * @Author: wangwangwang
     * @param {*} data
     */
    changePerson(value, data, arr) {
      const newData = arr.filter(item => item.id === value)
      data.phone = newData[0].phoneNum;
      data.name = newData[0].name;
    },
    copy(list) {
      let str = JSON.stringify(list);
      return JSON.parse(str);
    },
    riskInfoValidChange(val) {
      if (val === '1') {
        this.projectForm.riskInfo.validityOfDelegation = '有效';
      } else {
        this.projectForm.riskInfo.validityOfDelegation = '无效';
      }
    },
    riskInfoShutdownChange(val) {
      this.shutdownLogoList.forEach(item => {
        if (item.id === val) {
          this.projectForm.riskInfo.shutdownLogo = item.itemName;
          return;
        }
      })
    },
    /**再次编辑或者审核，重新初始化数据页面,查询详情 */
    getDetail() {
      const id = this.data.id;
      getDisClostDetail({ id: id }).then(async (res) => {
        if (res.data) {
          this.projectForm = { ...this.projectForm, ...res.data };
          if (this.projectForm.administrativeDistrictsId) {
            this.projectForm.administrativeDistrictsId0 = JSON.parse(this.projectForm.administrativeDistrictsId)//行政区
          }
          this.projectForm.strengthGradeArr = JSON.parse(this.projectForm.strengthGrade) ?.map((v) => v.id)//强度等级
          if (this.projectForm.performanceRate) {
            this.projectForm.performanceRateArr = JSON.parse(this.projectForm.performanceRate) ?.map((v) => v.id)//性能等级
          }
          if (this.projectForm.materialRequirements) {
            this.projectForm.materialRequirementsArr = JSON.parse(this.projectForm.materialRequirements) ?.map((v) => v.id)//材料要求
          }
          if (this.projectForm.specialRequirements) {
            this.projectForm.specialRequirementsArr = JSON.parse(this.projectForm.specialRequirements) ?.map((v) => v.id)//特殊要求
          }
          if (this.projectForm.otherRequirements) {
            this.projectForm.otherRequirementsArr = JSON.parse(this.projectForm.otherRequirements) ?.map((v) => v.id)//其他要求
          }
          if (this.projectForm.admixtureRequirements) {
            this.projectForm.admixtureRequirementsArr = JSON.parse(this.projectForm.admixtureRequirements) ?.map((v) => v.id)//外加剂要求
          }
          if (this.projectForm.pumpType) {
            this.projectForm.pumpTypeArr = JSON.parse(this.projectForm.pumpType) ?.map((v) => v.id)//泵送方式
          }
          if (this.projectForm.entrustBeginTime) {
            this.projectForm.entrustBeginTImeEntrustEndTime = [this.projectForm.entrustBeginTime, this.projectForm.entrustEndTime]
          }
          if (this.projectForm.clearingForm) {
            this.projectForm.clearingForms = this.projectForm.clearingForm.split(',');
          }
          if (this.projectForm.constructionStartDate) {
            this.projectForm.constructionStartDateConstructionEndDate = [this.projectForm.constructionStartDate, this.projectForm.constructionEndDate]
          }
          this.projectForm.firstIndateEndIndate = [this.projectForm.firstIndate, this.projectForm.endIndate];
          this.projectForm.list = res.data.list || [];
          const newData = this.projectForm.servicePoint ? JSON.parse(this.projectForm.servicePoint) : [];
          const copyData = newData.filter(item => item.type == 1);
          this.servicePoint = copyData.map(item => item.name).join(',');
          //合同回显组装
          const Arry1 = [];
          for (let i = 0; i < res.data.fileFist.length; i += 1) {
            if (res.data.fileFist[i].fileType === '1') {
              const data = {
                name: res.data.fileFist[i].fileName,
                fileName: res.data.fileFist[i].fileName,
                fileUrl: res.data.fileFist[i].path,
                path: res.data.fileFist[i].path,
                fileType: 1,
                createTime: res.data.fileFist[i].createTime,
                type: 1,
              }
              Arry1.push(data);
            }
          }
          this.listFilesa1 = Arry1;
        }
      })
      getManagement({ id: id }).then(res => {
        if (res.data) {
          res.data.validityOfDelegationId *= 1;
          res.data.reportLogoId *= 1;
        }
        this.projectForm.riskInfo = res.data || {}
      })
    },
    deleteFile1(index) {
      this.listFilesa1.splice(index, 1);
    },
    /**
     * @Description: 上传成功
     * @Param: 
     * @Author: wangwangwang
     */
    uplodeSuccess1(data) {
      const params = {
        name: data.fileName,
        fileName: data.fileName,
        fileUrl: data.fileUrl,
        path: data.fileUrl,
        fileType: 1,
        type: 1,
        createTime: new Date().Format('yyyy-MM-dd hh:mm:ss'),
      }
      this.listFilesa1.push(params);
    },
    handleClose() {
      this.$emit("closeSubmit");
    },
    nextAction() {
      this.$emit("handleSure", this.projectForm);
    },
    /**验证 */
    chackForm() {
      if (!this.projectForm.discloseType) {
        this.$message.warning('交底类型不能为空');
        return
      } else if (!this.projectForm.enginnerrName) {
        this.$message.warning('工程名称不能为空');
        return
      } else if (!this.projectForm.enginnerrNatureId) {
        this.$message.warning('工程性质不能为空');
        return
      } else if (!this.projectForm.enginnerrAddress) {
        this.$message.warning('工程地址不能为空');
        return
      } else if (!this.projectForm.administrativeDistrictsId0) {
        this.$message.warning('行政区不能为空');
        return
      } else if (this.projectForm.poolFlag === '') {
        this.$message.warning('联营标识不能为空');
        return
      } else if (this.projectForm.sidesFlag == 2 && !this.projectForm.sidesFlagType) {
        this.$message.warning('内外标识类型不能为空');
        return
      } else if (!this.projectForm.coordinateName) {
        this.$message.warning('协调主体不能为空');
        return
      } else if (!this.projectForm.businesNameId) {
        this.$message.warning('合同单位不能为空');
        return
      } else if (!this.projectForm.effectiveDate) {
        this.$message.warning('合同生效日期不能为空');
        return
      } else if (!this.projectForm.firstIndateEndIndate) {
        this.$message.warning('合同有效期不能为空');
        return
      } else if (!this.projectForm.modelOfContract) {
        this.$message.warning('合同模式不能为空');
        return
      } else if (!this.projectForm.budgetPersonId) {
        this.$message.warning('预算员不能为空');
        return
      } else if (!this.projectForm.sallerId) {
        this.$message.warning('销售员不能为空');
        return
      } else if (!this.projectForm.firstLeader) {
        this.$message.warning('甲方项目负责人及权限不能为空');
        return
      } else if (!this.projectForm.ourCompanyCheckPersonId) {
        this.$message.warning('我司合同签字人不能为空');
        return
      } else if (!this.projectForm.firstPartySignerId) {
        this.$message.warning('甲方小票签收人不能为空');
        return
      } else if (this.projectForm.strengthGradeArr.length == 0) {
        this.$message.warning('强度等级不能为空');
        return
      } else if (this.projectForm.pumpTypeArr.length == 0) {
        this.$message.warning('泵送方式不能为空');
        return
      } else if (!this.projectForm.smallVolume) {
        this.$message.warning('小方量约定不能为空');
        return
      } else if (!this.projectForm.unitWeight) {
        this.$message.warning('约定容重不能为空');
        return
      } else if (!this.projectForm.financialCode && this.ButtonList.findIndex(res => (res.buttonValue == 'CWXX')) !== -1) {
        this.$message.warning('财务编码不能为空');
        return
      } else if (!this.projectForm.ccContractNo && this.ButtonList.findIndex(res => (res.buttonValue == 'SCXX')) !== -1) {
        this.$message.warning('建委合同号不能为空');
        return
      } else if (!this.projectForm.mainSupplySiteId && this.ButtonList.findIndex(res => (res.buttonValue == 'SCXX')) !== -1) {
        this.$message.warning('主供应站点不能为空');
        return
      } else if (!this.projectForm.mainSupplySiteDistence && this.ButtonList.findIndex(res => (res.buttonValue == 'SCXX')) !== -1) {
        this.$message.warning('主供应站点距离不能为空');
        return
      }
      return true
    },
    /**
     * @Description: 保存 未处理权限问题
     * @Param:  基本交底信息、filedisAddCosts、产品与收费
     * @Author: wangwangwang
     */
    handleSave() {
      if (this.chackForm()) {
        this.saveBaseInfo();
      }
    },
    saveBaseInfo() {
      /**
       * 保存基本交底信息
       * @param  {[type]} params1).then(( [description]
       * @return {[type]}                 [description]
       */
      this.projectForm.fileFist = this.listFilesa1;
      if (this.projectForm.strengthGradeArr.length > 0) {
        this.projectForm.strengthGrade = JSON.stringify(this.projectForm.strengthGradeArr.map((v) => {
          let obj = { id: v, name: this.strengthGradeList.find((v2) => v2.id == v).name }
          return obj
        }))
      }
      if (this.projectForm.performanceRateArr.length > 0) {
        this.projectForm.performanceRate = JSON.stringify(this.projectForm.performanceRateArr.map((v) => {
          let obj = { id: v, name: this.performanceGradeList.find((v2) => v2.id == v).name }
          return obj
        }))
      } else {
        this.projectForm.performanceRate = ''
      }
      if (this.projectForm.materialRequirementsArr.length > 0) {
        this.projectForm.materialRequirements = JSON.stringify(this.projectForm.materialRequirementsArr.map((v) => {
          let obj = { id: v, name: this.meterialRequirementsList.find((v2) => v2.id == v).name }
          return obj
        }))
      } else {
        this.projectForm.materialRequirements = ''
      }
      if (this.projectForm.specialRequirementsArr.length > 0) {
        this.projectForm.specialRequirements = JSON.stringify(this.projectForm.specialRequirementsArr.map((v) => {
          let obj = { id: v, name: this.specialRequirementsList.find((v2) => v2.id == v).name }
          return obj
        }))
      } else {
        this.projectForm.specialRequirements = ''
      }
      if (this.projectForm.otherRequirementsArr.length > 0) {
        this.projectForm.otherRequirements = JSON.stringify(this.projectForm.otherRequirementsArr.map((v) => {
          let obj = { id: v, name: this.otherRequirementsList.find((v2) => v2.id == v).name }
          return obj
        }))
      } else {
        this.projectForm.otherRequirements = ''
      }
      if (this.projectForm.admixtureRequirementsArr.length > 0) {
        this.projectForm.admixtureRequirements = JSON.stringify(this.projectForm.admixtureRequirementsArr.map((v) => {
          let obj = { id: v, name: this.admixtureRequirementsList.find((v2) => v2.id == v).name }
          return obj
        }))
      } else {
        this.projectForm.admixtureRequirements = ''
      }
      if (this.projectForm.pumpTypeArr.length > 0) {
        this.projectForm.pumpType = JSON.stringify(this.projectForm.pumpTypeArr.map((v) => {
          let obj = { id: v, name: this.pumpTypeList.find((v2) => v2.id == v).itemName, type: this.pumpTypeList.find((v2) => v2.id == v).type }
          return obj
        }))
      } else {
        this.projectForm.pumpType = ''
      }
      this.projectForm.companyId = this.data.companyId
      this.projectForm.company = this.data.company
      if (this.projectForm.clearingForms ?.length > 0) {
        this.projectForm.clearingForm = this.projectForm.clearingForms.join(',');
      } else {
        this.projectForm.clearingForm = ''
      }
      saveOrUpdateDisclose(this.projectForm).then((res) => {
        if (res.code === 1001) {
          this.nextAction();
          this.$message.success('交底信息保存成功');
        }
      }).catch(() => {
        this.type = 0;
      });
    },
    // 提交审核前先保存一次数据
    handleSure() {
      if (this.chackForm()) {
        const { executePhase } = this.data;
        this.$emit("closeSubmit");
        // this.saveBaseInfo(true);
        this.$router.push({ name: 'ProjectClarifiFlow', query: { formData: JSON.stringify(this.projectForm), fileList1: JSON.stringify(this.listFilesa1), type: 1, companyId: this.data.companyId, company: this.data.company, executePhase } });
      }
    },
    /**原物料单选列表查询 */
    ListChoicePagingFun() {
      rawMaterialsQueryPage(this.ListChoicePaging).then((res) => {
        this.ListChoiceData = res.data.data
        this.ListChoicePaging.total = res.data.totalRows
      })
    },
    /**单选列表打开 */
    ListChoiceTypeFun(index, id) {
      this.ListChoiceType = true
      this.ListChoiceDataIndex = index
      if (id) {
        this.ListChoiceRadio = id
        this.ListChoiceRadioCopy = id
      } else {
        this.ListChoiceRadio = ''
        this.ListChoiceRadioCopy = ''
      }
      this.ListChoicePagingFun()
    },
    //单选选中
    ListChoiceFun(currentRow) {
      if (currentRow) {
        console.log(this.ListChoiceRadio + ';' + currentRow.id);
        let type = this.projectForm.list.findIndex((res) => res.materialsId == currentRow.id)
        if (type == -1 || this.ListChoiceRadioCopy == currentRow.id) {
          this.ListChoiceRadio = currentRow.id
          this.ListChoiceRadioRow = currentRow
        } else {
          this.$message({
            message: '该选项已被选择！',
            type: 'warning'
          });
          setTimeout(() => {
            this.ListChoiceRadioRow = ''
          }, 100);
        }
      }
    },
    /*表单*/
    addItem() {
      let data = {
        materialsId: "",
        materials: "",
        specification: "",
        mixingAmount: "0",
      };
      console.log(this.projectForm)
      this.projectForm.list.push(data);
    },
    deleteItem(index) {
      this.projectForm.list.splice(index, 1);
    },
    /**保存和校验不重复选中项 */
    ListChoiceAddFun() {
      //原物料选择后对应值【品牌，规格..】带入表格中
      this.projectForm.list[this.ListChoiceDataIndex].materialsId = this.ListChoiceRadioRow.id;
      this.projectForm.list[this.ListChoiceDataIndex].materials = this.ListChoiceRadioRow.name;
      this.projectForm.list[this.ListChoiceDataIndex].specification = this.ListChoiceRadioRow.specification;
      this.ListChoiceType = false
    }
  },
  mounted() { },
};
</script>
<style lang="scss" src="./../project.scss" scoped></style>
<style lang="scss" scoped>
.checkbox-bg {
  margin: 0 10px 10px 10px;
  display: inline-block;
}
.table_link {
  margin-left: 10px;
  color: $bg_color;
}

.pull-left {
  float: left;
}

.form-title {
  display: flex;
  justify-content: space-between;
}

.add-more {
  float: right;
}

.del-file {
  color: green;
  cursor: pointer;
}

.file-line {
  line-height: 2;
  border-bottom: 1px solid #ddd;
}

.text-danger,
.text-danger:focus {
  color: #ff5722;
}
</style>
<style>
.display-row-Fzy {
  display: none;
}
</style>